package com.xd.oauth.error;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * @author huboxin
 * @title: XdOAuthException
 * @projectName bk
 * @description:
 * @date 2020/8/219:51
 */
@JsonSerialize(using = XdAuthExceptionSerializer.class)
public class XdAuthException extends OAuth2Exception {
    private static final long serialVersionUID = -102425304015729659L;
    private Integer status = 400;

    public XdAuthException(String message, Throwable t) {
        super(message, t);
        status = ((OAuth2Exception)t).getHttpErrorCode();
    }

    public XdAuthException(String message) {
        super(message);
    }

    @Override
    public int getHttpErrorCode() {
        return status;
    }
}
